=======================================================================================================================================
Mod Title: Custom Field Template

Mod Version: 1.0

Mod Author: John Briggs

Mod Description:
This mod will provide an additional field to your profile and threads.

Mod Copyright:  2007-2008 XMBMods.com. All rights reserved.

Mod Compatibility: XMB 1.9.8 Engage Final SP2

Mod Install Note: Before adding this mod to your forum, you should back up all files related to this mod.

Mod License Note: This mod is released under the GPL v3 License. A copy is provided with this software.

Mod Author Note:
This modification is developed and released for use with XMB 1.9.8 Engage Final SP2 which is provided by XMBMods.com.

=======================================================================================================================================
=======
How To:
=======

This is a basic template on how to create a new custom field of your choice.

1]
First thing to do is to replace all instances of the word "stuff" (without quotes) with the name of your choice.
A example of how to replace the word "stuff" with a new name is if you want to make a new field named state then you
would replace all instances of the word "stuff" with the word "state".

2]
Once you have done this you want to make sure the language variable uses the description you desire. Look for this code
$lang['stuff'] = "Stuff:"; and make sure you apply #1 to it as well.

3]
Make sure that the SQL insert is also adjusted according to what #1 explains.

=======================================================================================================================================
=======
Step 1:
=======

===================================
Go To Admin Panel -> Insert Raw SQL
===================================

=======================================================================
Go to Admin Panel -> Insert Raw SQL -> Paste Code Below & Click Submit:
=======================================================================

ALTER TABLE `$table_members` ADD `stuff` varchar(75) NOT NULL default '';

=======================================================================================================================================
=======
Step 2:
=======

==========================
Edit File: editprofile.php
==========================

==========
Find Code:
==========

    $newsite = formVar('newsite');
    $site = $newsite ? checkInput($newsite, 'no', 'no', 'javascript', false) : '';

===============
Add Code Below:
===============

    $newstuff = formVar('newstuff');
    $stuff = $newstuff ? checkInput($newstuff, 'no', 'no', 'javascript', false) : '';

==========
Find Code:
==========

    $sig = addslashes($sig);

===============
Add Code Below:
===============

    $stuff = addslashes($stuff);

==========
Find Code:
==========

$db->query("UPDATE ".X_PREFIX."members SET email='$email',

==================================================
Find Code In-Line At End Of Above Query Statement:
==================================================

 WHERE username='$user'");

==================
Replace Code With:
==================

, stuff='$stuff' WHERE username='$user'");

=======================================================================================================================================
=======
Step 3:
=======

=====================
Edit File: member.php
=====================

==========
Find Code:
==========

loadtemplates(
'member_coppa',

=================
Replace Code With:
=================

loadtemplates(
'member_coppa',
'member_profile_stuff',

==========
Find Code:
==========

            $sig = isset($_POST['sig']) ? checkInput($_POST['sig'], '', $SETTINGS['sightml'], '', false) : '';

===============
Add Code Below:
===============

            $stuff = formVar('stuff');
            $stuff = $stuff ? checkInput($stuff, '', '', 'javascript', false) : '';

==========
Find Code:
==========

            $sig = addslashes($sig);

===============
Add Code Below:
===============

            $stuff = addslashes($stuff);

============================
Find Code On 1st Occurrence:
============================

                $db->query("INSERT INTO ".X_PREFIX."members (username,

=====================================
Find Code In-Line In Above Statement:
=====================================

) VALUES ('$username',

==================
Replace Code With:
==================

, stuff) VALUES ('$username',

==========================================
Find Code At End Of Above Query Statement:
==========================================

)");

==================
Replace Code With:
==================

, '$stuff')");

============================
Find Code On 2nd Occurrence:
============================

                $db->query("INSERT INTO ".X_PREFIX."members (username,

=====================================
Find Code In-Line In Above Statement:
=====================================

) VALUES ('$username',

==================
Replace Code With:
==================

, stuff) VALUES ('$username',

==========================================
Find Code At End Of Above Query Statement:
==========================================

)");

==================
Replace Code With:
==================

, '')");

==========
Find Code:
==========

                if (X_MEMBER && $memberinfo['email'] != '' && $memberinfo['showemail'] == 'yes') {
                    $email = $memberinfo['email'];
                } else {
                    $email = '';
                }

===============
Add Code Below:
===============

                $stuffblock = '';
                if ($memberinfo['stuff'] != '') {
                    $memberinfo['stuff'] = censor($memberinfo['stuff']);
                    eval('$stuffblock = "'.template('member_profile_stuff').'";');
                }

=======================================================================================================================================
=======
Step 4:
=======

====================
Edit File: memcp.php
====================

==========
Find Code:
==========

        $newsite = formVar('newsite');
        $site = $newsite ? checkInput($newsite, 'no', 'no', 'javascript', false) : '';

===============
Add Code Below:
===============

        $newstuff = formVar('newstuff');
        $stuff = $newstuff ? checkInput($newstuff, 'no', 'no', 'javascript', false) : '';

==========
Find Code:
==========

        $sig = addslashes($sig);

===============
Add Code Below:
===============

        $stuff = addslashes($stuff);

==========
Find Code:
==========

$db->query("UPDATE ".X_PREFIX."members SET $pwtxt email='$email',

==================================================
Find Code In-Line At End Of Above Query Statement:
==================================================

 WHERE username='$xmbuser'");

==================
Replace Code With:
==================

, stuff='$stuff' WHERE username='$xmbuser'");

=======================================================================================================================================
=======
Step 5:
=======

=========================
Edit File: viewthread.php
=========================

==========
Find Code:
==========

            if ($post['location'] != '') {
                $post['location'] = censor($post['location']);
                $location = '<br />'.$lang['textlocation'].' '.$post['location'];
            } else {
                $location = '';
            }

===============
Add Code Below:
===============

            $stuff = '';
            if ($post['stuff'] != '') {
                $post['stuff'] = censor($post['stuff']);
                $stuff = '<br /><strong>'.$lang['stuff'].'</strong> '.$post['stuff'];
            }

==========
Find Code:
==========

            $u2u = '';
            $location = '';
            $mood = '';

===============
Add Code Below:
===============

            $stuff = '';

=======================================================================================================================================
=======
Step 6:
=======

================================
Edit File: lang/English.lang.php
================================

==========
Find Code:
==========

?>

===============
Add Code Above:
===============

$lang['stuff'] = "Stuff:";

=======================================================================================================================================
=======
Step 7:
=======

=======================================================
Go To Admin Panel -> Templates -> admintool_editprofile
=======================================================

==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textlocation]</td>
<td bgcolor="$altbg2"><input type="text" name="newlocation" size="25" value="$member[location]" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[stuff]</td>
<td bgcolor="$THEME[altbg2THEME["><input type="text" name="newstuff" size="25" value="$member[stuff]" /></td>
</tr>

=======================================================================================================================================
=======
Step 8:
=======

=====================================================
Go To Admin Panel -> Templates -> member_reg_optional
=====================================================

==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textlocation]</td>
<td bgcolor="$altbg2"><input type="text" name="location" size="25" value="" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[stuff]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="stuff" size="25" value="" /></td>
</tr>

=======================================================================================================================================
=======
Step 9:
=======

===============================================
Go To Admin Panel -> Templates -> memcp_profile
===============================================

==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textlocation]</td>
<td bgcolor="$altbg2"><input type="text" name="newlocation" size="25" value="$member[location]" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[stuff]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="newstuff" size="25" value="$member[stuff]" /></td>
</tr>

=======================================================================================================================================
========
Step 10:
========

=================================================
Go To Admin Panel -> Templates -> viewthread_post
=================================================

==========
Find Code:
==========

$location

===============
Add Code Below:
===============

$stuff

=======================================================================================================================================
========
Step 11:
========

================================================
Go To Admin Panel -> Templates -> member_profile
================================================

==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1">$lang[textlocation]</td>
<td bgcolor="$altbg2">$memberinfo[location]</td>
</tr>

===============
Add Code Below:
===============

$stuffblock

=======================================================================================================================================
========
Step 12:
========

===========================================================================
Go To Admin Panel -> Templates -> Create New Template: member_profile_stuff
===========================================================================

=========================
Add Code &  Click Submit:
=========================

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[stuff]</td>
<td bgcolor="$THEME[altbg2]">$memberinfo[stuff]</td>
</tr>

=======================================================================================================================================